using System;
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;

public class UILogic : MonoBehaviour
{
    public TextMeshProUGUI scoreText;
    public TextMeshProUGUI livesText;
    private void Awake()
    {
        DontDestroyOnLoad(this.gameObject);
    }

    private void OnEnable()
    {
        GameManager.Instance.onScoreChanged += SetScore;
        GameManager.Instance.onLivesChanged += SetLives;
    }

    private void OnDisable()
    {
        GameManager.Instance.onScoreChanged -= SetScore;
        GameManager.Instance.onLivesChanged -= SetLives;
    }

    public void SetScore(int score)
    {
        scoreText.text = score.ToString();
    }
    
    public void SetLives(int lives)
    {
        livesText.text = lives.ToString();
    }


}
